﻿package game 
{
	import flash.events.Event;
	import game.events.EventData;
	import flash.external.ExternalInterface;
	/**
	 * ...
	 * @author Doan Nguyen Thuy Nha Truc (Bamboo)	
	 */
	public class GameLocalConnection extends BaseLocalConnection
	{
		
		public function GameLocalConnection() {
			super();
			
		}
		
		//receivedInfoConnectGameHdl for MIN MAX
		/*public function recieveMainText(lang:String, user:String, pass:String, roomId:String, isMemberSpecial:String, arrLang:Array, arrID:Array,
		siteName:String, casinoID:String, fmsVideo:String, fmsMonitor:String, limelight:String, preUser:String, isDemo:String, hidePassword:String, 
		parentSID:String, minBet:String, maxBet:String):void
  		{
			ExternalInterface.call("alertScript", "nhan receive main text");
			GlobalVariables.lang = lang;
			GlobalVariables.userName = user;
			GlobalVariables.pass = pass; 
			GlobalVariables.roomId = roomId;
			GlobalVariables.isMemberSpecial = isMemberSpecial;
			
			GlobalVariables.arrLang = arrLang;
			GlobalVariables.arrID = arrID;
			GlobalVariables.siteName = siteName;
			GlobalVariables.casinoId = casinoID;
			GlobalVariables.fmsVideo = fmsVideo; 	
			var tmp:Array = fmsMonitor.split("$");
			GlobalVariables.fmsMonitor = tmp[1];
			GlobalVariables.fmsMonitor1 = tmp[0];
			//GlobalVariables.fmsMonitor = fmsMonitor;
			GlobalVariables.limelight = limelight;
			GlobalVariables.preUser = preUser;
			GlobalVariables.isDemo = isDemo;
			GlobalVariables.hidePassword = hidePassword;
			GlobalVariables.parentSID = parentSID;
			dispatchEvent(new Event(EventData.LOAD_GAME));
			GlobalVariables.minBet = Number(minBet);
			GlobalVariables.maxbet = Number(maxBet);
		}*/
		
		public function recieveMainText(lang:String, user:String, pass:String, roomId:String, isMemberSpecial:String, arrLang:Array, arrID:Array,
		siteName:String, casinoID:String, fmsVideo:String, fmsMonitor:String, limelight:String, preUser:String, isDemo:String, hidePassword:String, parentSID:String, dynamicLobby:String):void
  		{
			ExternalInterface.call("alertScript", "nhan receive main text")
			GlobalVariables.lang = lang;
			GlobalVariables.userName = user;
			GlobalVariables.pass = pass; 
			GlobalVariables.roomId = roomId;
			GlobalVariables.isMemberSpecial = isMemberSpecial;
			
			GlobalVariables.arrLang = arrLang;
			GlobalVariables.arrID = arrID;
			
			var domain:Array = siteName.split("@");
			GlobalVariables.siteName = domain[0];
			
			GlobalVariables.casinoId = casinoID;
			GlobalVariables.fmsVideo = fmsVideo; 	
			var tmp:Array = fmsMonitor.split("$");
			GlobalVariables.fmsMonitor = tmp[1];
			GlobalVariables.fmsMonitor1 = tmp[0];
			//GlobalVariables.fmsMonitor = fmsMonitor;
			GlobalVariables.limelight = limelight;
			GlobalVariables.preUser = preUser;
			GlobalVariables.isDemo = isDemo;
			GlobalVariables.hidePassword = hidePassword;
			GlobalVariables.parentSID = parentSID;
			dispatchEvent(new Event(EventData.LOAD_GAME));
		}
		
		
		
		public function sendStatusAllGame(listGame:String)
		{
			GlobalVariables.listStatusGame = listGame;
			dispatchEvent(new Event(EventData.UPDATE_STATUS_GAME));
		}
		
		
		public function sendInfoLoadComplete(info:String):void
  		{
			super.localConnection.send(super.connectionNameSend, "recieveGameDetailText", info);
			//ExternalInterface.call("alertScript", "recieveGameDetailText")
			//trace("sendInfoLoadComplete:" + super.connectionNameSend);
		}
		
		/*public function sendStatusRoom(roomId:String, statusRomm:String):void {
			super.localConnection.send(super.connectionNameSend, "recieveGameDetailStatusRoom", roomId, statusRomm);
		}*/
		
		public function sendTokenInvalid():void {			
			super.localConnection.send("TokenFail" + GlobalVariables.getDate, "TokenText", "info");
		}
		
		public function receiveLogoutmain(str:String):void {
			dispatchEvent(new Event(EventData.CLOSE_GAME));
		}
	}

}